
#include "turboshapepaint.h"

Line::Line()
{

}

void Line::paint(QPainter &painter)
{
    QPen penDraw(Qt::red);
    penDraw.setWidth(3);
    painter.setPen(penDraw);
    painter.drawPolyline(QPolygon(line_points_));
}

void Line::pushLinePoint(const QPoint &point)
{
    line_points_.push_back(point);
}

Rect::Rect()
{

}

void Rect ::paint(QPainter &painter)
{
    QPen penDraw(Qt::red);
    penDraw.setWidth(3);
    painter.setPen(penDraw);
    painter.drawRect(left_up_pos_.x(), left_up_pos_.y(),right_down_pos_.x() - left_up_pos_.x(), right_down_pos_.y() - left_up_pos_.y());
}

Ellipse::Ellipse()
{

}

void Ellipse::paint(QPainter &painter)
{
    QPen penDraw(Qt::red);
    penDraw.setWidth(3);
    painter.setPen(penDraw);
    painter.drawEllipse(left_up_pos_.x(), left_up_pos_.y(),right_down_pos_.x() - left_up_pos_.x(), right_down_pos_.y() - left_up_pos_.y());
}

Arrow::Arrow()
{

}

void Arrow::paint(QPainter &painter)
{
    QPen penDraw(Qt::red);
    penDraw.setWidth(3);
    painter.setPen(penDraw);
    line_points_ = getArrowShape();
    painter.drawPolygon(QPolygon(line_points_));
}

void Arrow::pushLinePoint(const QPoint &point)
{
    line_points_.push_back(point);
}

Mosaic::Mosaic()
{

}

void Mosaic::paint(QPainter &painter)
{
    QPen pen;
    pen.setBrush(getMosaic());
    pen.setWidth(10);
    painter.setPen(pen);
    painter.drawPolyline(QPolygon(line_points_));
}

void Mosaic::pushLinePoint(const QPoint &point)
{
    line_points_.push_back(point);
}

void Mosaic::setMosaic(const QPixmap &map)
{
    mosaic_map_ = map;
}

QPixmap Mosaic::getMosaic()
{
    return mosaic_map_;
}



